package fr.upmc.alasca.centreCalcul.interne.controleurAdmission.ports;

import fr.upmc.alasca.centreCalcul.interne.controleurAdmission.ControleurAdmission;
import fr.upmc.alasca.centreCalcul.interne.controleurAdmission.interfaces.ControleurAdmissionI;
import fr.upmc.alasca.centreCalcul.objets.DemandeChangementCoeur;
import fr.upmc.components.ComponentI;
import fr.upmc.components.ComponentI.ComponentService;
import fr.upmc.components.ports.AbstractInboundPort;


/**
 * @author Antoine Lavaire, Sabri Labassi, Thibaut Fleury, Ryme Fantazi
 */
public	class	ControleurAdmissionInboundPort
extends			AbstractInboundPort
implements		ControleurAdmissionI
{
	private static final long serialVersionUID = 1L;
	
	
	public	ControleurAdmissionInboundPort
	(
		String		p_uri,
		ComponentI	p_owner
	) throws	Exception
	{
		super(p_uri, ControleurAdmissionI.class, p_owner);
		
		assert this.uri != null && this.owner instanceof ControleurAdmission;
	}


	@Override
	public	void	ajouterCoeurs
	(
		final	DemandeChangementCoeur	p_demandeAjoutCoeur
	) throws	Exception
	{
		final ControleurAdmission ca = (ControleurAdmission) this.owner;
		ca.handleRequestAsync(
				new ComponentService<Void>() {
					@Override
					public Void call() throws Exception {
						 ca.ajouterCoeurs(p_demandeAjoutCoeur);
						 return null;
					}
				});
	}
}
